<%--
  Created by IntelliJ IDEA.
  User: hqqs
  Date: 2020/10/11
  Time: 8:20 上午
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@include file="/manageHtml/admin_menu.jsp"%>
    <!--/sidebar-->
    <div class="main-wrap">

        <div class="crumb-wrap">
            <div class="crumb-list"><i class="icon-font"></i><a href="../manageHtml/admin_index.jsp">首页</a><span class="crumb-step">&gt;</span><span class="crumb-name">用户管理</span></div>
        </div>
        <div class="search-wrap">
            <div class="search-content">
                <form action=<%=request.getContextPath()%>"/manageHtml/admin_doUserShow" method="get">
                    <table class="search-tab">
                        <tr>
<%--                            <th width="120">选择分类:</th>--%>
<%--                            <td>--%>
<%--                                <select name="search-sort" id="">--%>
<%--                                    <option value="">全部</option>--%>
<%--                                    <option value="19">精品界面</option><option value="20">推荐界面</option>--%>
<%--                                </select>--%>
<%--                            </td>--%>
                            <th width="70">关键字:</th>
                            <td><input class="common-text" placeholder="关键字" name="keywords" value="${param.keywords}" id="" type="text"></td>
                            <td><input class="btn btn-primary btn2" name="sub" value="查询" type="submit"></td>
                        </tr>
                    </table>
                </form>
            </div>
        </div>
        <div class="result-wrap">
            <form action=<%=request.getContextPath()%>"/manageHtml/admin_doUserDelete" id="myform" method="post">
                <div class="result-title">
                    <div class="result-list">
                        <a href="/manageHtml/admin_useradd.jsp"><i class="icon-font"></i>新增用户</a>
                        <a id="batchDel" href="javascript:DeleteAll('你确定删除这些用户么？','myform')"><i class="icon-font"></i>批量删除</a>
                        <a id="updateOrd" href="javascript:void(0)"><i class="icon-font"></i>更新排序</a>
                    </div>
                </div>
                <div class="result-content">
                    <table class="result-tab" width="100%">
                        <tr>
                            <th class="tc" width="5%"><input class="allChoose" name="" onclick="selall(this)" type="checkbox"></th>
                            <th>ID</th>
                            <th>姓名</th>
                            <th>性别</th>
                            <th>邮箱</th>
                            <th>手机</th>
                            <th>操作</th>
                        </tr>

                        <c:forEach var="u" items="${userlist}">

                        <tr>

                            <td class="tc"><input name="id[]" value="${u.USER_ID}" type="checkbox"></td>
                            <td>${u.USER_ID}</td>
                            <td>${u.USER_NAME}</td>
                            <td>${u.USER_SEX=='T'?'男':'女'}</td>
                            <td>${u.USER_EMAIL}</td>
                            <td>${u.USER_MOBILE}</td>


                            <td>
                                <a class="link-update" href=<%=request.getContextPath()%>"/manageHtml/admin_toUserUpdate?id=${u.USER_ID}&cpage=${cpage}">修改</a>

                                <c:if test="${u.USER_STATUS ==1}">
                                    <a class="link-del" href="javascript:Delete('你确定要删除该用户[${u.USER_NAME}]么?',<%=request.getContextPath()%>'/manageHtml/admin_doUserDelete?id=${u.USER_ID}&cpage=${cpage}')">删除</a>
                                </c:if>

                            </td>
                        </tr>
                        </c:forEach>

                        <script>
                            function Delete(mess,url) {
                                if (confirm(mess)) {//用于删除弹窗的返回
                                    location.href = url;
                                }
                            }

                            function selall(o){//点击了表头的全选矿
                                var a=document.getElementsByName('id[]');//获取下方所有框框的id
                                for (var i=0;i<a.length;i++){
                                    a[i].checked = true;//全选

                                }

                            }

                            function DeleteAll(mess,formname){
                                if (confirm(mess)) {//用于删除弹窗的返回
                                    //location.href = url;
                                    var  form = document.getElementById(formname);//獲取表單
                                    form.submit();//提交
                                }
                            }
                        </script>

                    </table>
                    <div class="list-page">
                        <a href="manageHtml/admin_doUserShow?cp=1${searchParams}">首页</a>
                        <a href="manageHtml/admin_doUserShow?cp=${cpage-1 <= 0?1:cpage-1}${searchParams}">上一页</a>
                        共${tsum}条记录，当前${cpage}/${pagenum}页
                        <a href="manageHtml/admin_doUserShow?cp=${cpage+1 >=pagenum?pagenum:cpage+1}${searchParams}">下一页</a>
                        <a href="manageHtml/admin_doUserShow?cp=${pagenum}${searchParams}">尾页</a>


                    </div>
                </div>
            </form>
        </div>
    </div>
    <!--/main-->
</div>
</body>
</html>
